﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace DC.Serialization.Event
{
    class Program
    {
        static void Main(string[] args)
        {
            using(ServiceHost host = new ServiceHost(typeof(DC.Serialization.Event.Services), new Uri("net.tcp://10.176.12.39:8001/service/")))
            {
                
                if (host.Description.Behaviors.Find<ServiceMetadataBehavior>() == null)
                {
                    ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
                    host.Description.Behaviors.Add(behavior);
                }

                host.AddServiceEndpoint(typeof(DC.Serialization.Event.IServiceContract), new NetTcpBinding(), "");
                host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex");

                host.Open();
                Console.WriteLine("Service started");
                Console.ReadKey();
                host.Close();
            }
        }
    }
}
